package geral.manager;

import java.io.ByteArrayInputStream;
import java.io.Serializable;

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

import org.primefaces.event.CaptureEvent;
import org.primefaces.model.DefaultStreamedContent;

@Named
@SessionScoped
public class ImagemManager implements Serializable{
	
	private static final long serialVersionUID = 503470956500793465L;
	
	private DefaultStreamedContent foto;
	
	private byte[] dataByte;
	
	public void oncapture(CaptureEvent event){
		dataByte = event.getData();
		foto = new DefaultStreamedContent(new ByteArrayInputStream(dataByte));
	}

	public DefaultStreamedContent getFoto() {
		return foto;
	}

	public void setFoto(DefaultStreamedContent foto) {
		this.foto = foto;
	}

	public byte[] getDataByte() {
		return dataByte;
	}

	public void setDataByte(byte[] dataByte) {
		this.dataByte = dataByte;
	}
	
}
